package com.heima.user.controller;

import com.heima.user.dto.UserRepDto;
import com.heima.user.entity.User;
import com.heima.user.service.IUserService;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/user")
@RequiredArgsConstructor
public class UserController {

    private final IUserService userService;

    @GetMapping("/{id}")
    public User abc(@PathVariable("id") Long id){
        return userService.getById(id);
    }
    // {"mobile":"1380013800","pwd":"12121"}
    @PostMapping("/login")
    public String login(@RequestBody UserRepDto dto){
        return userService.login(dto);
    }
}
